package com.hq.fxh.No5_User.User.Adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.VideoView;

import com.hq.fxh.CustomerView.CircleImageView;
import com.hq.fxh.Intefers.GuanZhuListCallBack;
import com.hq.fxh.R;
import com.hq.fxh.Utils.ClickUtils;
import com.hq.fxh.Utils.Tool;

import static cn.jpush.android.api.JPushInterface.a.v;

/**
 * /**
 *
 * @author 薛
 * @ClassName
 * @Description :
 * @Created 2017/9/15
 * @Email xlwenhao1858@sina.com
 */


public class Ladapter_FenSi extends BaseAdapter {
    GuanZhuListCallBack callBack;

    public void setCallBack(GuanZhuListCallBack callBack) {
        this.callBack = callBack;
    }

    @Override
    public int getCount() {
        return 10;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View convertView, ViewGroup parent) {
        View view = convertView;
        ViewHolder viewHolder = null;
        if (view == null || !(view.getTag() instanceof ViewHolder)) {
            view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_guanzhu_user_name, null);
            viewHolder = new ViewHolder(view);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }

        final ViewHolder finalViewHolder = viewHolder;

        viewHolder.btnGZPFocus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                callBack.clickGuanZhu(finalViewHolder.btnGZPFocus, false, "1", 0);

            }
        });

        ClickUtils.clickGuanzhu(parent.getContext(),viewHolder.btnGZPFocus,true);

        return view;
    }

    static class ViewHolder {
        protected CircleImageView imageGZPIcon;
        protected TextView tvGZPName;
        protected ImageView imageGZPTag;
        protected LinearLayout layoutGZPUser;
        protected TextView btnGZPFocus;

        ViewHolder(View rootView) {
            initView(rootView);
        }

        private void initView(View rootView) {
            imageGZPIcon = (CircleImageView) rootView.findViewById(R.id.image_GZP_icon);
            tvGZPName = (TextView) rootView.findViewById(R.id.tv_GZP_name);
            imageGZPTag = (ImageView) rootView.findViewById(R.id.image_GZP_tag);
            layoutGZPUser = (LinearLayout) rootView.findViewById(R.id.layout_GZP_User);
            btnGZPFocus = (TextView) rootView.findViewById(R.id.btn_GZP_Focus);
        }
    }

}
